package hydrap2p.speedlimiter;

import hydrap2p.download.Source;

public interface SpeedLimitedQueue {
	
	/**
	 * Allow an amount of time to pass, and allow certain transfers to finish
	 */
	public void update();
	
	/**
	 * Enqueue a transfer
	 * @param peer
	 * @param download
	 * @param amount
	 */
	public void attempt(Source peer, boolean download, int amount);
	
	/**
	 * Returns the number of transfers waiting
	 * @return
	 */
	public int size();
	
	/**
	 * Sets the speed that this queue goes at, in bytes per second
	 * @return
	 */
	public void setSpeed(int amount);
	
	/**
	 * Returns the speed that this queue goes at, in bytes per second
	 * @return
	 */
	public int getSpeed();
	
	/**
	 * Immediately cause all transfers to complete 
	 */
	public void clear();
}
